package library.gui.scene;

import javafx.geometry.Insets;
import javafx.geometry.Pos;
import javafx.scene.layout.BorderPane;
import javafx.scene.text.Font;

import library.gui.SystemApplication;
import library.gui.component.FunctionalButton;
import library.gui.component.TitleLabel;
import library.gui.component.VButtonList;
import library.gui.dialog.NotiDialog;

public class MainMenuPane extends BorderPane{

	private SystemApplication handler;

	private int width = 480;
	
	private TitleLabel title = new TitleLabel(SystemApplication.TITLE);
	private VButtonList buttonPane;
	
	public MainMenuPane(SystemApplication handler) {
		
		this.handler = handler;
		
		this.setPrefWidth(width);
		BorderPane.setAlignment(title, Pos.CENTER);
		this.setTop(title);
		
		this.buttonPane = new VButtonList (
				new FunctionalButton("登录", this.handler::toLoginScene),
				new FunctionalButton("注册", this.handler::toRegisterScene),
				new FunctionalButton("关于", ()->{
					new NotiDialog("关于", "图书馆管理系统", "Author：单诗雯 袁伟乐 古海龙")
						.showAndWait();
				}),
				new FunctionalButton("退出", this.handler::exit));
		this.buttonPane.foreach((x)->{
			x.setFont(new Font("BOLD", 20));
//			setMargin(x, new Insets(5, 20, 5, 20));
		}); 
		this.setCenter(buttonPane);

//		this.buttonPane.setPrefWidth(width);
		
	}
	
}
